using System;
using System.Xml;
using UnityEngine;
namespace AssemblyCSharp
{
	public class RotationDAO : XmlParserDAO, CommonDAOIF<RotationDomain>
	{
		public RotationDAO ()
		{
		}

		private RotationDomain mRotationDomain = null;
		
		public bool readStarXml(String xmlString)
		{
			return mXmlParser.readXmlString(xmlString);
		}
		
		public override System.Object parse()
		{
			try
			{
				String returnValue = "";
				mRotationDomain = new RotationDomain();
				
				foreach(XmlNode item in mXmlParser.xmlDoc.ChildNodes)
				{
					GetChildren(item);
				}
				
				return returnValue;
			}
			catch ( Exception e )
			{
				Debug.Log( e.ToString());
				return null;
			}
		}
		
		private void GetChildren(XmlNode node)
		{
			if (node.LocalName == Constant.RotationAxis) {
				mRotationDomain.RotationAxis = Convert.ToInt32(node.InnerText);
			} else if (node.LocalName == Constant.RotationClockwise) {
				mRotationDomain.RotationClockwise = Convert.ToInt32(node.InnerText);
			} else if (node.LocalName == Constant.RotationTime) {
				mRotationDomain.RotationTime = Convert.ToInt32(node.InnerText);
			} 
			else
			{
				foreach (XmlNode item in node.ChildNodes)
				{
					GetChildren(item);
				}
			}
		}
		
		public RotationDomain getDomain ()
		{
			return mRotationDomain;
		}
	}
}

